package mc

import (
	"gitee.com/dreamwood/ez-go/db/mgo"
)

const (
	CheckTemplateEventNew          = "mes.CheckTemplateNew"
	CheckTemplateEventBeforeCreate = "mes.CheckTemplateBeforeCreate"
	CheckTemplateEventBeforeUpdate = "mes.CheckTemplateBeforeUpdate"
	CheckTemplateEventBeforeSave   = "mes.CheckTemplateBeforeCreate mes.CheckTemplateBeforeUpdate"
	CheckTemplateEventAfterCreate  = "mes.CheckTemplateAfterCreate"
	CheckTemplateEventAfterUpdate  = "mes.CheckTemplateAfterUpdate"
	CheckTemplateEventAfterSave    = "mes.CheckTemplateAfterCreate mes.CheckTemplateAfterUpdate"
	CheckTemplateEventDelete       = "mes.CheckTemplateDelete"

	CheckTemplateAccessControlEvent = "mes.CheckTemplateAccessControl"
)

func GetCheckTemplateConfig() *mgo.DocConfig {
	return CheckTemplate_Config
}

var CheckTemplate_Config *mgo.DocConfig

func init() {
	CheckTemplate_Config = NewCheckTemplateConfig()
}

func NewCheckTemplateConfig() *mgo.DocConfig {
	return &mgo.DocConfig{
		ContainerKey: "mes.CheckTemplate",
		Fields: []string{
			"name", "department", "process", "checkProcess",
		},
		RelationFields: []string{
			"department", "process", "checkProcess",
		},
		RelationConfigs: map[string]*mgo.DocRelation{

			"department": {
				Config:     GetDepartmentConfig,
				DocName:    "Department",
				JoinType:   "O",
				KeyInside:  "departmentId",
				KeyOutSide: "id",
			},

			"process": {
				Config:     GetProcessConfig,
				DocName:    "Process",
				JoinType:   "O",
				KeyInside:  "processId",
				KeyOutSide: "id",
			},

			"checkProcess": {
				Config:     GetCheckProcessConfig,
				DocName:    "CheckProcess",
				JoinType:   "O",
				KeyInside:  "checkProcessId",
				KeyOutSide: "id",
			},
		},
		FieldFilter: map[string]*mgo.DocFieldFilter{
			"default": {
				Select: []string{},
				Omit:   []string{},
			},
		},
	}
}
